package com.cover.fti.play;

import org.anddev.andengine.entity.text.ChangeableText;
import org.anddev.andengine.opengl.font.Font;

import com.qwerjk.andengine.entity.sprite.PixelPerfectAnimatedSprite;
import com.qwerjk.andengine.opengl.texture.region.PixelPerfectTiledTextureRegion;

public class Enemy extends PixelPerfectAnimatedSprite {

	private int life;
	private int score;
	private float speed;
	private int attackSpeed;
	private int index;
	private String tipe;
	private Boolean destroy;
	private PixelPerfectTiledTextureRegion mPixelPerfectTiledTextureRegion;
	private ChangeableText liveText;
	private Font mFont;
	
	public Enemy(float pX, float pY,
			PixelPerfectTiledTextureRegion pTiledTextureRegion, Font pFont, int index) {
		super(pX, pY, pTiledTextureRegion);
		mPixelPerfectTiledTextureRegion = pTiledTextureRegion;
		mFont = pFont;
		life = 10;
		score = 100;
		speed = 10f;
		this.index = index;
		attackSpeed = 50;
		tipe = "normal";
		destroy = false;
		liveText = new ChangeableText(this.getWidth()/2, this.getHeight(), mFont, life + "", "xxx".length());
		this.attachChild(liveText);
	}

	public int getIndex(){
		return index;
	}
	
	public void setLife(int life) {
		this.life = life;
		if(this.life < 0){
			this.life = 0;
		} 
		liveText.setText(life + "");
	}

	public int getLife() {
		return life;
	}

	public void setScore(int score) {
		this.score = score;
	}

	public int getScore() {
		return score;
	}

	public void setSpeed(float speed) {
		this.speed = speed;
	}

	public float getSpeed() {
		return speed;
	}

	public void setTipe(String tipe) {
		this.tipe = tipe;
	}

	public String getTipe() {
		return tipe;
	}

	public void setDestroy(Boolean destroy) {
		this.destroy = destroy;
	}

	public Boolean getDestroy() {
		return this.destroy;
	}

	public PixelPerfectTiledTextureRegion getEnemyPixelPerfectTiledTextureRegion() {
		return mPixelPerfectTiledTextureRegion;
	}
	
	public Font getFont(){
		return mFont;
	}

	public void setAttackSpeed(int attackSpeed) {
		this.attackSpeed = attackSpeed;
	}

	public int getAttackSpeed() {
		return this.attackSpeed;
	}
}
